<template>
  <div class="chart-container">
    <el-table :data="tableData" style="width: 100%" :span-method="objectSpanMethod" border>
      <el-table-column prop="date" label="日期"></el-table-column>
      <el-table-column prop="name" label="姓名"></el-table-column>
      <el-table-column prop="address" label="地址"></el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "demoTwo",
  filters: {},
  data() {
    return {
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄"
        }
      ]
    };
  },
  created() {},
  mounted() {},
  methods: {

     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
       console.log(rowIndex)
          if (columnIndex === 0) { 
               //用于设置要合并的列
              if (rowIndex== 0) {   //用于设置合并开始的行号
                return {
                  rowspan: 2,　　　　　//合并的行数
                  colspan: 1          //合并的列数，设为０则直接不显示
                };
              } else {
                return {
                  rowspan: 1,
                  colspan: 1
                };
              }

          }
      }


  }
};
</script>

<style lang="scss" scoped>
.chart-container {
  /* position: relative;
  width: 100%;
  height: calc(100vh - 84px); */
}
</style>
